﻿import net.streampower.forms.RadioButton;


class net.streampower.forms.RadioButtonSet extends MovieClip implements net.streampower.forms.Formulable{
	
	private var list:Array;
	private var value:Object;
	
	private var __label:String;
	
	public function RadioButtonSet(){
		this.list = new Array();
	}
	public function addRadioButton(pBut:RadioButton):Void{
		pBut.rbSet = this;
		this.list.push(pBut);
	
	}
	public function addRadioButtons(pButs:Array):Void{
		
		for(var i=0;i<pButs.length;i++){
			addRadioButton(pButs[i])
		}
	}	
	public function setValue(pValue:Object, pClip:RadioButton):Void{
		for(var i=0;i<this.list.length;i++){
			if(pValue == this.list[i].value){
				this.value = pValue;
				this.list[i].check(true, pClip);
			}else{
				this.list[i].check(false, pClip);
			}
		}
				
	}
	public function getValue():String{
		return value.toString();
	}
	public function setLabel(pString:String):Void{
		this.__label = pString;
	}
	public function getLabel():String{
	 	return	this.__label;
	}

	
}

